<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateShopArchiveTables extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('shop_archive', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('shopId')->default(0);
            $table->string('businessLicense')->default('')->comment('营业执照 - 经营范围');
            $table->date('businessLicenseStartDate')->nullable()->comment('营业执照 - 发证日期');
            $table->date('businessLicenseEndDate')->nullable()->comment('营业执照 - 到期日期（永久：9999-12-13）');
            $table->string('foodBusinessLicense')->default('')->comment('食品经营许可证 - 经营范围');
            $table->date('foodBusinessLicenseStartDate')->nullable()->comment('食品经营许可证 - 发证日期');
            $table->date('foodBusinessLicenseEndDate')->nullable()->comment('食品经营许可证 - 到期日期（永久：9999-12-13）');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '门店档案';

            $table->index('shopId', 'idx_shopId');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('shop_archive');
    }
}
